import applicationInfo from '../util/applicationInfo.js'
import Vue from 'vue';
console.log('load directive js')
/**
 * 设置对象高度为屏幕内容区高度（全面屏去除掉刘海，以及头部、底部）
 */
// 状态栏高度
const statusBarHeight = applicationInfo.statusBarHeight
// 头部高度
const headerBarHeight = applicationInfo.navigationBarHeight
// 状态栏+头部高度
const navbarHeight = (applicationInfo.navigationBarHeight + (applicationInfo.statusBarHeight || 0))
// 包含头部+状态栏及底部tab的情况下，内容区的高度
const contentHeight = applicationInfo.screenHeight - (applicationInfo.statusBarHeight || 0) - applicationInfo.tabBarHeight -
	applicationInfo.navigationBarHeight

Vue.directive('statusbar', {
	bind (el) {
		console.log('aaaaaaaaaaaaaaaaaaaaaaaaa')
		el.style.height = statusBarHeight + 'px'
	},
	inserted () {
		console.log('bbbbbbbbbbbbbbb')
	}
})

Vue.directive('headerbar', {
	bind (el) {
		el.style.height = headerBarHeight + 'px'
		el.style.top = statusBarHeight + 'px'
	}
})

Vue.directive('navbar', {
	bind (el) {
		el.style.height = navbarHeight + 'px'
	}
})

Vue.directive('content-height', {
	bind (el) {
		el.style.height = contentHeight + 'px'
	}
})
